package com.cyh.ebptasywar.common.config;

import com.cyh.ebptasywar.thread.BaseThread;
import com.cyh.ebptasywar.thread.ExecuteThread;
import com.cyh.ebptasywar.thread.MonitorThread;
import com.cyh.ebptasywar.thread.RefreshThread;
import com.cyh.ebptpubjar.ebptlogger.EbptLogger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.core.annotation.Order;

/**
 * 线程的配置类
 */
@Configuration
@Order(1)
public class ThreadsConfig {

    /**
     * Execute线程实例化
     * @return
     */
    @Bean("executeThread")
    @Scope("singleton")
    public BaseThread createExecuteThread(){
        EbptLogger.info(getClass(),"------create  ExecuteThread------");
        return new ExecuteThread();
    }

    /**
     * Monitor线程实例化
     * @return
     */
    @Bean("monitorThread")
    @Scope("singleton")
    public BaseThread createMonitorThread(){
        EbptLogger.info(getClass(),"------create  MonitorThread------");
        return new MonitorThread();
    }

    /**
     * Refresh线程实例化
     * @return
     */
    @Bean("refreshThread")
    @Scope("prototype")
    public BaseThread createRefreshThread(){
        EbptLogger.info(getClass(),"------create  RefreshThread------");
        return new RefreshThread();
    }
}
